package com.eling.elcms.travel.model;

import com.eling.elcms.basedoc.model.EnumSerializer;
import com.eling.elcms.basedoc.model.Room;
import com.eling.elcms.core.dao.annotation.Between;
import com.eling.elcms.core.dao.annotation.In;
import com.eling.elcms.core.dao.hibernate.search.EnumBridge;
import com.eling.elcms.core.model.BaseModel;
import com.eling.elcms.system.model.CommonUser;
import com.eling.elcms.travel.model.CheckInImplement.CheckStatus;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.hibernate.search.annotations.*;

import javax.persistence.*;
import java.util.Date;

/**
 * 房间登记
 * 
 * @author wulina
 * 
 * 增加热水抄表以及退房热水抄表
 *
 */
@Entity
@Table(name = "travel_roomregister")
@Indexed
public class RoomRegister extends BaseModel {

	private static final long serialVersionUID = -4765584360226572567L;

	@Id
	@In
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@DocumentId
	private Long pkRoomRegister;

	/** 房间 */
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
	@JoinColumn(name = "pkRoom")
	@IndexedEmbedded(depth = 1)
	private Room room;

	/** 入住价 */
	@Column
	private Double checkInPrice;
	
	/** 退房价 */
	@Column
	private Double checkOutPrice;

	/** 入住价说明 */
	@Column
	private String checkInPriceMark;

	/** 房卡/钥匙 */
	@Column
	private Boolean cardKey;

	/** 水 */
	@Column
	private Boolean water;

	/** 电 */
	@Column
	private Boolean electric;

	/** 天然气 */
	@Column
	private Boolean gas;

	/** 电话 */
	@Column
	private Boolean telephone;

	/** 宽带 */
	@Column
	private Boolean wireless;

	/** 落实备注 */
	@Column
	private String pendDescription;

	/** 房价是否含水电费 */
	@Column
	@Field
	private Boolean waterElectric;

	/** 水表抄表值（立方） */
	@Column
	@Field
	private Double waterMeter;
	
	/** 入住热水抄表值（立方）*/
	@Column
	@Field
	private Double hotWaterMeter;

	/** 电表抄表值（度） */
	@Column
	@Field
	private Double electricMeter;

	/** 入住抄表日期 */
	@Field
	@Column
	@Between
	private Date checkInMeterDate;

	/** 水表抄表值（立方） 退房确认 */
	@Column
	@Field
	private Double checkOutWaterMeter;

	/**退住热水抄表值（立方） 退房确认*/
	@Column
	@Field
	private Double checkOutHotWaterMeter;
	
	/** 电表抄表值（度）退房确认 */
	@Column
	@Field
	private Double checkOutElectricMeter;

	/** 退住抄表日期 */
	@Field
	@Column
	@Between
	private Date checkOutMeterDate;

	/** 房价是否含早餐 */
	@Column
	@Field
	private Boolean breakfast;

	/** 早餐价（元/人） */
	@Column
	@Field
	private Double price;
	
	/** 房价是否含三餐 */
	@Column
	@Field
	private Boolean threeMeals;

	/** 处理人 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "operator")
	@IndexedEmbedded(depth = 1)
	private CommonUser operator;

	/** 处理时间 */
	@Column
	private Date operateDate;

	/** 状态 无要求，待落实，已落实 */
	@Enumerated(EnumType.STRING)
	@Field
	@FieldBridge(impl = EnumBridge.class)
	@In
	private CheckStatus status;

	/** 房间状态 */
	@Enumerated(EnumType.STRING)
	@Field
	@FieldBridge(impl = EnumBridge.class)
	@In
	private RoomStatus roomStatus;

	@JsonSerialize(using = EnumSerializer.class)
	public static enum RoomStatus {
		NoCheckIn("待入住"), CheckIn("待退住"), finish("完成");

		private String display;

		RoomStatus(String display) {
			this.display = display;
		}

		public String getDisplay() {
			return display;
		}
	}

	/** 报名类型 前台显示为入住类型 */
	@Enumerated(EnumType.STRING)
	@Field
	@FieldBridge(impl = EnumBridge.class)
	@In
	private CheckInType checkInType;

	@JsonSerialize(using = EnumSerializer.class)
	public static enum CheckInType {
		NonMember("散客"), Member("会员团"), Alliance("联盟团");

		private String display;

		CheckInType(String display) {
			this.display = display;
		}

		public String getDisplay() {
			return display;
		}
	}

	@Version
	private Integer version;

	
	public Double getHotWaterMeter() {
		return hotWaterMeter;
	}

	public void setHotWaterMeter(Double hotWaterMeter) {
		this.hotWaterMeter = hotWaterMeter;
	}

	public Double getCheckOutHotWaterMeter() {
		return checkOutHotWaterMeter;
	}

	public void setCheckOutHotWaterMeter(Double checkOutHotWaterMeter) {
		this.checkOutHotWaterMeter = checkOutHotWaterMeter;
	}

	public Long getPkRoomRegister() {
		return pkRoomRegister;
	}

	public void setPkRoomRegister(Long pkRoomRegister) {
		this.pkRoomRegister = pkRoomRegister;
	}

	public Room getRoom() {
		return room;
	}

	public void setRoom(Room room) {
		this.room = room;
	}

	public Double getCheckInPrice() {
		return checkInPrice;
	}

	public void setCheckInPrice(Double checkInPrice) {
		this.checkInPrice = checkInPrice;
	}

	public Double getCheckOutPrice() {
		return checkOutPrice;
	}

	public void setCheckOutPrice(Double checkOutPrice) {
		this.checkOutPrice = checkOutPrice;
	}

	public String getCheckInPriceMark() {
		return checkInPriceMark;
	}

	public void setCheckInPriceMark(String checkInPriceMark) {
		this.checkInPriceMark = checkInPriceMark;
	}

	public Boolean getCardKey() {
		return cardKey;
	}

	public void setCardKey(Boolean cardKey) {
		this.cardKey = cardKey;
	}

	public Boolean getWater() {
		return water;
	}

	public void setWater(Boolean water) {
		this.water = water;
	}

	public Boolean getElectric() {
		return electric;
	}

	public void setElectric(Boolean electric) {
		this.electric = electric;
	}

	public Boolean getGas() {
		return gas;
	}

	public void setGas(Boolean gas) {
		this.gas = gas;
	}

	public Boolean getTelephone() {
		return telephone;
	}

	public void setTelephone(Boolean telephone) {
		this.telephone = telephone;
	}

	public Boolean getWireless() {
		return wireless;
	}

	public void setWireless(Boolean wireless) {
		this.wireless = wireless;
	}

	public String getPendDescription() {
		return pendDescription;
	}

	public void setPendDescription(String pendDescription) {
		this.pendDescription = pendDescription;
	}

	public Boolean getWaterElectric() {
		return waterElectric;
	}

	public void setWaterElectric(Boolean waterElectric) {
		this.waterElectric = waterElectric;
	}

	public Double getWaterMeter() {
		return waterMeter;
	}

	public void setWaterMeter(Double waterMeter) {
		this.waterMeter = waterMeter;
	}

	public Double getElectricMeter() {
		return electricMeter;
	}

	public void setElectricMeter(Double electricMeter) {
		this.electricMeter = electricMeter;
	}

	public Double getCheckOutWaterMeter() {
		return checkOutWaterMeter;
	}

	public void setCheckOutWaterMeter(Double checkOutWaterMeter) {
		this.checkOutWaterMeter = checkOutWaterMeter;
	}

	public Double getCheckOutElectricMeter() {
		return checkOutElectricMeter;
	}

	public void setCheckOutElectricMeter(Double checkOutElectricMeter) {
		this.checkOutElectricMeter = checkOutElectricMeter;
	}

	public Boolean getBreakfast() {
		return breakfast;
	}

	public void setBreakfast(Boolean breakfast) {
		this.breakfast = breakfast;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public CommonUser getOperator() {
		return operator;
	}

	public void setOperator(CommonUser operator) {
		this.operator = operator;
	}

	public Date getOperateDate() {
		return operateDate;
	}

	public void setOperateDate(Date operateDate) {
		this.operateDate = operateDate;
	}

	public CheckStatus getStatus() {
		return status;
	}

	public void setStatus(CheckStatus status) {
		this.status = status;
	}

	public CheckInType getCheckInType() {
		return checkInType;
	}

	public void setCheckInType(CheckInType checkInType) {
		this.checkInType = checkInType;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public Date getCheckOutMeterDate() {
		return checkOutMeterDate;
	}

	public void setCheckOutMeterDate(Date checkOutMeterDate) {
		this.checkOutMeterDate = checkOutMeterDate;
	}

	public RoomStatus getRoomStatus() {
		return roomStatus;
	}

	public void setRoomStatus(RoomStatus roomStatus) {
		this.roomStatus = roomStatus;
	}

	public Date getCheckInMeterDate() {
		return checkInMeterDate;
	}

	public void setCheckInMeterDate(Date checkInMeterDate) {
		this.checkInMeterDate = checkInMeterDate;
	}

	public Boolean getThreeMeals() {
		return threeMeals;
	}

	public void setThreeMeals(Boolean threeMeals) {
		this.threeMeals = threeMeals;
	}


}
